package org.csu.jpetstore.service;

import org.csu.jpetstore.domain.Order;
import org.csu.jpetstore.persistence.OrderDAO;
import org.csu.jpetstore.persistence.impl.OrderDAOImpl;

import java.util.List;

public class OrderService {

    OrderDAO orderDAO;

    public OrderService() {
        orderDAO = new OrderDAOImpl();
    }

    public int addOrder(Order order) {
        return orderDAO.insertOrder(order);
    }

    public Order getOrderById(int id) {
        return orderDAO.getOrderByOrderid(id);
    }

    public List<Order> getOrderByUser(String username) {
        return orderDAO.getOrderByUsername(username);
    }

    public List<Integer> getAllOrderId() {
        return orderDAO.getAllOrderId();
    }

}
